package certificates

import (
	"gitee.com/djaf/my-certs/app/data/dxo"
	"gitee.com/djaf/my-certs/app/data/entity"
	"gitee.com/djaf/my-certs/app/web/dto"
	"gorm.io/gorm"
)

// DAO ...
type DAO interface {
	Insert(db *gorm.DB, item *entity.Certificate) (*entity.Certificate, error)

	Find(db *gorm.DB, id dxo.CertificateID) (*entity.Certificate, error)

	List(db *gorm.DB, query *Query) ([]*entity.Certificate, error)
}

// CSRDAO ...
type CSRDAO interface {
	Insert(db *gorm.DB, item *dto.CSR) (*dto.CSR, error)

	Update(db *gorm.DB, id dxo.CSRID, fn func(item *dto.CSR)) (*dto.CSR, error)

	Remove(db *gorm.DB, id dxo.CSRID) error

	Find(db *gorm.DB, id dxo.CSRID) (*dto.CSR, error)
}
